MANU BAR

banner image
banner image

database connectivity in asp.net using ms sql server(Search records)

 database connectivity in asp.net using ms sql server(Search records)



Code for Search Button:-

protected void Button1_Click(object sender, EventArgs e)

    {

 

        DatabaseConnectivityClass obj = new DatabaseConnectivityClass();

        DataSet ds = new DataSet();

        ds = obj.DataSetReturn("Select *from StudentTable where StudentId="+TextBox5.Text);

      

        if( ds.Tables[0].Rows.Count>=1)

        {

          Label1.Text="Record Found";

          TextBox1.Text=ds.Tables[0].Rows[0]["NameofStudent"].ToString();

          TextBox2.Text=ds.Tables[0].Rows[0]["CourseName"].ToString();

          TextBox3.Text=ds.Tables[0].Rows[0]["Address"].ToString();

          TextBox4.Text = ds.Tables[0].Rows[0]["ContactNumber"].ToString();

        }

        else

        {

        Label1.Text="Record Not Found";

        TextBox1.Text = "";

        TextBox2.Text = "";

        TextBox3.Text = "";

        TextBox4.Text = "";

 

         }

 

}


database connectivity in asp.net using ms sql server(Search records) database connectivity in asp.net using ms sql server(Search records) Reviewed by JOB ORIENTED STUDY ACADEMY on October 17, 2020 Rating: 5

No comments:

Powered by Blogger.